/**
 * 主组件继承Base，刷新后重载相关基础接口数据，并更新到Vuex
 */
import { Vue, Component } from "vue-property-decorator";
import { namespace } from "vuex-class";

const UserModule = namespace("User");

@Component
export default class Base extends Vue {
  @UserModule.State("currentUser") currentUser!: any;
  @UserModule.State("roles") roles!: string[];
  @UserModule.State("permissions") permissions!: string[];
  @UserModule.Action("setUser") setUser!: Function;
  @UserModule.Action("updateUser") updateUser!: Function;

  /**
   * 是否是项目负责人
   */
  get superIsProjectLeader() {
    const _return = this.roles && this.roles.find((item: any) => item === "project_leader") ? true : false;
    return _return;
  }
}
